﻿<UserControl x:Class="SoftSource.Timecard.Views.ProjectListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:converters="clr-namespace:SoftSource.Timecard.Converters"
             xmlns:timecardControls="clr-namespace:SoftSource.Timecard.Controls"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             xmlns:Blacklight_Controls="clr-namespace:Blacklight.Controls;assembly=Blacklight.Controls"
             xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             d:DesignWidth="662"
             d:DesignHeight="404">

    <UserControl.Resources>
        <converters:ProjectStatusToEditVisibilityConverter x:Key="ProjectStatusToEditVisibilityConverter" />
    </UserControl.Resources>

    <controlsToolkit:BusyIndicator x:Name="Busy"
                                   HorizontalContentAlignment="Stretch"
                                   VerticalContentAlignment="Stretch">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal">
                    <CheckBox x:Name="ActiveCheckBox"
                              Content="Active"
                              Margin="4"
                              Checked="CheckBoxFilter_CheckChanged"
                              Unchecked="CheckBoxFilter_CheckChanged"
                              IsChecked="True" />
                    <CheckBox x:Name="CompletedCheckBox"
                              Content="Completed"
                              Margin="4"
                              Checked="CheckBoxFilter_CheckChanged"
                              Unchecked="CheckBoxFilter_CheckChanged" />
                    <CheckBox x:Name="SuspendedCheckBox"
                              Content="Suspended"
                              Margin="4"
                              Checked="CheckBoxFilter_CheckChanged"
                              Unchecked="CheckBoxFilter_CheckChanged" />
                    <CheckBox x:Name="DelayedCheckBox"
                              Content="Delayed"
                              Margin="4"
                              Checked="CheckBoxFilter_CheckChanged"
                              Unchecked="CheckBoxFilter_CheckChanged" />
                    <CheckBox x:Name="NotStartedCheckBox"
                              Content="Not Started"
                              Margin="4"
                              Checked="CheckBoxFilter_CheckChanged"
                              Unchecked="CheckBoxFilter_CheckChanged" />
                </StackPanel>
                <TextBox x:Name="FilterTextBox"
                         HorizontalAlignment="Left"
                         MinWidth="175"
                         Margin="10,0,0,0"
                         VerticalAlignment="Stretch"
                         TextWrapping="Wrap"
                         d:LayoutOverrides="Width, Height"
                         Grid.Column="1" />
                <Grid HorizontalAlignment="Left"
                      VerticalAlignment="Bottom"
                      Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Button Content="Add New"
                            d:LayoutOverrides="Height"
                            Width="75"
                            Margin="4,2"
                            Click="AddNew_Click" />
                    <Button Content="Clone"
                            d:LayoutOverrides="Height"
                            Grid.Column="1"
                            Width="75"
                            Margin="4,2"
                            Click="Clone_Click" />
                </Grid>
            </Grid>
            <data:DataGrid x:Name="ProjectDataGrid"
                           ItemsSource="{Binding Projects, Mode=OneWay}"
                           AutoGenerateColumns="False"
                           Grid.Row="1">
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn Header="Name"
                                             Binding="{Binding Name, Mode=OneWay}" />
                    <data:DataGridTextColumn Header="Manager"
                                             Binding="{Binding UserSummary.FullName, Mode=OneWay}" />
                    <data:DataGridTextColumn Header="Status"
                                             Binding="{Binding StatusID, Converter={StaticResource ProjectStatusIDConverter}, ConverterParameter='Description', Mode=OneWay}" />
                </data:DataGrid.Columns>
            </data:DataGrid>
        </Grid>
    </controlsToolkit:BusyIndicator>
</UserControl>